import request from '@/utils/request'

/**
 * 登录
 * @param data
 * @returns
 */
export const login = <T>(data: any) =>
  request.post<T>('/admin-core/web/account/v1/login', data)

/**
 * 获取用户信息
 * @param params
 * @returns
 */
export const getUser = <T>(params?: any) =>
  request.get<T>('admin/info', { params })

/**
 * 更新用户信息
 * @param params
 * @returns
 */
export const updateUser = <T>(data?: any) =>
  request.post<T>('/admin-core/web/account/v1/update', data)

/**
 * 保存用户信息
 * @param params
 * @returns
 */
export const saveUser = <T>(data?: any) =>
  request.post<T>('/admin-core/web/account/v1/save', data)

/**
 * 删除用户信息
 * @param params
 * @returns
 */
export const delUser = <T>(data?: any) =>
  request.post<T>('/admin-core/web/account/v1/removeAccount', data)

/**
 * 获取用户列表
 * @param params
 * @returns
 */
export const getUserList = (params: any) =>
  request({
    url: 'admin/userList',
    params,
  })

/**
 * 删除用户列表
 * @param params
 * @returns
 */
export const userRemove = (data: any) => request.delete('admin/remove', data)

export const logout = () => request.post('/admin-core/web/account/v1/loginOut')
